/*
 * Copyright 2023 Stanislav Aleshin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gitee.wsl.compose.screenmodel

import com.gitee.wsl.compose.coroutines.CoroutineManager
import kotlinx.coroutines.flow.FlowCollector
import com.gitee.wsl.compose.screenmodel.communications.state.EffectCommunicator
import com.gitee.wsl.compose.screenmodel.communications.state.StateCommunicator
import com.gitee.wsl.compose.screenmodel.contract.BaseAction
import com.gitee.wsl.compose.screenmodel.contract.BaseEvent
import com.gitee.wsl.compose.screenmodel.contract.BaseUiEffect
import com.gitee.wsl.compose.screenmodel.contract.BaseViewState
import com.gitee.wsl.compose.screenmodel.store.launchedStore

/**
 * @author Stanislav Aleshin on 14.02.2023.
 */
//abstract class BaseScreenModel<S : BaseViewState, E : BaseEvent, A : BaseAction, F : BaseUiEffect, D : ScreenDependencies>(
//    protected val stateCommunicator: StateCommunicator<S>,
//    protected val effectCommunicator: EffectCommunicator<F>,
//    coroutineManager: CoroutineManager,
//) : ScreenModel, Reducer<S, A>, Actor<S, E, A, F>, ContractProvider<S, E, F, D> {
//
//    private val scope get() = screenModelScope
//
//    protected var isInitialize = AtomicBoolean(false)
//
//    private val store = launchedStore(
//        scope = scope,
//        effectCommunicator = effectCommunicator,
//        stateCommunicator = stateCommunicator,
//        actor = this,
//        reducer = this,
//        coroutineManager = coroutineManager,
//    )
//
//    override fun init(deps: D) {
//        isInitialize.set(true)
//    }
//
//    override fun dispatchEvent(event: E) = store.sendEvent(event)
//
//    override suspend fun collectState(collector: FlowCollector<S>) {
//        store.collectState(collector)
//    }
//
//    override suspend fun collectUiEffect(collector: FlowCollector<F>) {
//        store.collectUiEffect(collector)
//    }
//}
